package com.ms.game.itembox.container;


public class ItemDrawInfo {
	
	/** 無限*/
	private static final int UNLIMITED = -1;
	
	
	/** 道具 id */
	private String itemId;

	/** 數量 */
	private int count;
	
	/** 權重*/
	private int wieght;
	
	/** 此道具總數*/
	private int totalCount;
	
	/** 被抽到的數量**/
	private int drawCount;
	
	public boolean isDrawFinish(){
		if(totalCount == UNLIMITED) {
			return false;
		}
		
		if (drawCount >= totalCount) {
			return true;
		}
		return false;
	}
	
	public String getItemId() {
		return itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getWieght() {
		return wieght;
	}

	public void setWieght(int wieght) {
		this.wieght = wieght;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	@Override
	public boolean equals(Object obj) { //只要ID跟數量一樣，就是完全一樣
		if (!(obj instanceof ItemDrawInfo)) {
			return false;
		}
		
		ItemDrawInfo info = (ItemDrawInfo) obj;
		
		if (!itemId.equals(info.itemId)) {
			return false;
		}
		
		if (count != info.getCount()) {
			return false;
		}
		return true;
	}

	public int getDrawCount() {
		return drawCount;
	}

	public void setDrawCount(int drawCount) {
		this.drawCount = drawCount;
	}
	
}
